package com.diver.flinkdemo.entity.Trd.dx;

/**
 * Created with IntelliJ IDEA.
 *
 * @Description:
 * @Author: zhangB
 * @Date: 2022/02/11 10:12
 */
public class DxResult {

    public static<W> DxRestResultVo getSuccessVo(W data){
        DxRestResultVo<W> vo = new DxRestResultVo();
        vo.setData(data);
        return vo;
    }

    public static<W> DxRestResultVo getSuccessVo(String msg,W data){
        DxRestResultVo<W> vo = new DxRestResultVo();
        vo.setData(data);
        vo.setMessage(msg);
        return vo;
    }

    public static DxRestResultVo getSuccessVo(){
        return getSuccessVo(null);
    }

    public static DxRestResultVo getErrorVo(DxStatusCode statusCode){
        DxRestResultVo vo = new DxRestResultVo();
        vo.setCode(statusCode.getCode());
        vo.setMessage(statusCode.getMessage());
        return vo;
    }

    public  static DxRestResultVo getErrorVo(DxStatusCode statusCode, String msg){
        DxRestResultVo vo = new DxRestResultVo();
        vo.setCode(statusCode.getCode());
        vo.setMessage(msg);
        return vo;
    }

}
